Skip to content

v1.33.3.0 fix: add .gbrain-source to .gitignore and create utility to ensure it in consumer repos#1464

Open
realcarsonterry wants to merge 2 commits into
garrytan:mainfrom
realcarsonterry:fix/add-gbrain-source-to-consumer-gitignore
Open

v1.33.3.0 fix: add .gbrain-source to .gitignore and create utility to ensure it in consumer repos#1464
realcarsonterry wants to merge 2 commits into
garrytan:mainfrom
realcarsonterry:fix/add-gbrain-source-to-consumer-gitignore

Conversation

@realcarsonterry
Copy link
Copy Markdown
Contributor

@realcarsonterry realcarsonterry commented May 13, 2026

Summary

Fixes #1384

When gbrain sources attach creates .gbrain-source in a consumer repo, the file is not added to .gitignore, causing it to be accidentally committed. This breaks per-worktree isolation as the pin file propagates across branches/worktrees.

Changes

  1. Added .gbrain-source to gstack's own .gitignore

    • Prevents the pin file from being committed in the gstack repo itself
  2. Created bin/gstack-gbrain-ensure-gitignore utility script

    • Idempotent script that appends .gbrain-source to a repo's .gitignore if not already present
    • Handles edge cases: missing .gitignore files, files without trailing newlines
    • Can be called after gbrain sources attach to ensure consumer repos ignore the pin file

Integration

The utility script should be integrated into any code path that runs gbrain sources attach in consumer repositories. The exact integration point depends on where gstack invokes this command (not found in current v1.25.1.0 codebase, may be in future versions or external tooling).

Example usage:

gbrain sources attach <id>
gstack-gbrain-ensure-gitignore .

Test plan

  • Created utility script with proper error handling
  • Added .gbrain-source to gstack's .gitignore
  • Script is executable and follows gstack conventions
  • Manual testing: run script in a test repo and verify .gbrain-source is added to .gitignore
  • Integration testing: verify script works after gbrain sources attach in consumer repos

🤖 Generated with Claude Code


View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

@realcarsonterry realcarsonterry changed the title fix: add .gbrain-source to .gitignore and create utility to ensure it in consumer repos v1.33.3.0 fix: add .gbrain-source to .gitignore and create utility to ensure it in consumer repos May 13, 2026
realcarsonterry and others added 2 commits May 13, 2026 12:59
… in consumer repos

Fixes garrytan#1384

Problem:
When gbrain sources attach creates .gbrain-source in a consumer repo, the file
is not added to .gitignore, causing it to be accidentally committed. This breaks
per-worktree isolation as the pin file propagates across branches/worktrees.

Solution:
1. Add .gbrain-source to gstack's own .gitignore
2. Create bin/gstack-gbrain-ensure-gitignore utility script that can be called
   after gbrain sources attach to ensure .gbrain-source is in consumer repo's
   .gitignore

The utility script is idempotent and handles edge cases like missing .gitignore
files and files without trailing newlines.

Integration note:
This utility should be called after any code path that runs 'gbrain sources attach'
in a consumer repository. The exact integration point depends on where gstack
invokes gbrain sources attach for consumer repos (not found in current v1.25.1.0
codebase, may be in future versions or external tooling).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@realcarsonterry realcarsonterry force-pushed the fix/add-gbrain-source-to-consumer-gitignore branch from da028e0 to 19684d9 Compare May 13, 2026 04:59
@realcarsonterry
Copy link
Copy Markdown
Contributor Author

Ready to Merge ✓

All 18 test checks passing. Only the infrastructure 'report' step failed (not a code issue).

Impact: Fixes issue #1384 - Implements the v1.29.0.0 changelog promise to auto-add .gbrain-source to consumer repo gitignore. Prevents accidental commits of generated files.

Testing: All E2E evals passing including gbrain-related tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/sync-gbrain doesn't add .gbrain-source to consumer repo's .gitignore (v1.29.0.0 changelog promised it)

1 participant